﻿using Project1.Application.System.Dtos;

namespace Project1.Application
{
    /// <summary>
    /// 系统服务接口
    /// </summary>
    public class SystemAppService : IDynamicApiController
    {
        private readonly ISystemService _systemService;
        public SystemAppService(ISystemService systemService)
        {
            _systemService = systemService;
        }

        /// <summary>
        /// 获取系统描述
        /// </summary>
        /// <returns></returns>
        public string GetDescription()
        {
            return _systemService.GetDescription();
        }

        /// <summary>
        /// 问题1：使用某些词汇时会触发异常，详情请看下方异常堆栈信息；
        /// </summary>
        /// <param name="message">输入带有敏感词汇的测试文本</param>
        /// <returns></returns>
        public string TestBug([SensitiveDetection('*'), FromQuery] string message = "李月月鸟")
        {
            return message;
        }

        /// <summary>
        /// 问题2：当在返回值的属性上使用脱敏特性时，无法将响应中的敏感词汇替换掉；
        /// </summary>
        /// <returns></returns>
        public TestReturnOutput TestReturn()
        {
            TestReturnOutput output = new()
            {
                return_message = "李月月鸟"
            };
            return output;
        }
    }
}